package com.qf.service.impl;

import com.qf.dao.UserDao;
import com.qf.dao.impl.UserDaoImpl;
import com.qf.entity.User;
import com.qf.service.UserService;

public class UserServiceImpl implements UserService {
    private UserDao userDao = new UserDaoImpl();

    @Override
    public User findOneByUser(String phone) {
        return null;
    }

    @Override
    public boolean add(User user) {
        int result = userDao.add(user);
        if (result >= 1) {
            return true;
        }
        return false;
    }

    @Override
    public User login(User user) {
        User result = userDao.login(user);
        return result;
    }

    @Override
    public User findOneById(Integer id) {
        User user = userDao.findOne(id);
        if (user == null){
            return null;
        }
        return user;
    }

    @Override
    public boolean update(User user) {
        int a = userDao.update(user);
        if (a >= 1){
            return true;
        }
        return false;
    }
}
